package com.jyc.financing.activity;

import android.app.ActionBar;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

import com.android.jyc.financing.R;

public class MainActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ActionBar actionBar = getActionBar();
        actionBar.setTitle(getResources().getString(R.string.app_name));
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }


	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// TODO Auto-generated method stub
		menuChoice(item);
		return super.onOptionsItemSelected(item);
	}
    
	private boolean menuChoice(MenuItem item){
		switch (item.getItemId()) {
		case android.R.id.home:
			Toast.makeText(this,   
	                "Home",   
	                Toast.LENGTH_SHORT).show();
			return true;
		case R.id.action_main_refresh:
			Toast.makeText(this,   
	                "Refresh",   
	                Toast.LENGTH_SHORT).show();
			return true;
		case R.id.action_main_other:
			Toast.makeText(this,   
	                "Other",   
	                Toast.LENGTH_SHORT).show();
			return true;
		case R.id.action_main_settings:
			Toast.makeText(this,   
	                "Setting",   
	                Toast.LENGTH_SHORT).show();
			return true;
		default:
			break;
		}
		
		return false;
	}
}
